/*
 * AttackType.h
 *
 *  Created on: Oct 8, 2011
 *  Created by: Devin Manno
 *  Updated by: Devin Manno,
 *	Last Update: Oct 19, 2011
 */

#ifndef ATTACKTYPE_H_
#define ATTACKTYPE_H_

#include "Base.h"
#include <vector>
#include <ctime>
#include <cstdlib>
#include <string.h>
#include <ostream>
#include <istream>
#include <stdio.h>
//#include "Player.h"


#define DELIMS ",\n"
#define MAX 250
using namespace std;
using std::string;
using std::ostream;
using std::istream;

class AttackType{
    friend ostream& operator<<(ostream& out, AttackType& a)
    {
        out << a.description << ',' << a.baseDamage << ',' << a.actionPointsCost;
        return out;
    }

    friend istream& operator>>(istream& in, AttackType& a)
    {
        char *tk = NULL;// pointers to chars
        char data[MAX] = ""; //to hold line
        in.getline(data,MAX - 1, '\n');
        tk = strtok(data, DELIMS); // get next token
        a.description = tk;
        tk = strtok(NULL, DELIMS); // get next token
        a.baseDamage = atoi(tk);
        tk = strtok(NULL, DELIMS); // get next token
        a.actionPointsCost = atoi(tk);
        return in;
    }

private:
	std::string description;	// the name of the attack
	int baseDamage;		// amount of hit points it takes from enemy
	int actionPointsCost;	// amount of action points necessary to perform attack

public:
	AttackType();
	AttackType(string name, int bDamage, int apCost);
	virtual ~AttackType();

	// getters
	int getBaseDamage()const;
	int getActionPointsCost()const;
	string getDesc()const;

	// setters
	void setBaseDamage(int newDmg);
	void setActionPointsCost(int newAPCost);
	void setDesc(std::string desc);	// set the description

};

#endif /* ATTACKTYPE_H_ */
